﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace console.demo.senior
{
    public class TestAuthorAttribute
    {
        public static void Test()
        {
            printAuthorInfo(typeof(FirstClass));
            printAuthorInfo(typeof(SecondClass));
            printAuthorInfo(typeof(ThirdClass));
        }

        private static void printAuthorInfo(Type t)
        {
            Console.WriteLine("Author information for {0}", t);
            Attribute[] attributes = Attribute.GetCustomAttributes(t);
            foreach (Attribute a in attributes)
            {
                if (a is Self)
                {
                    Self self = (Self)a;
                    Console.WriteLine("{0}, version {1:f}", self.GetName(), self.version);
                }
            }
        }
    }
}
